package com.fair.concurrency.example.atomic;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.atomic.AtomicReference;

/**
 * @author 朝花不迟暮
 * @version 1.0
 * @date 2020/9/21 14:22
 */
@Slf4j
public class AtomicReferenceExample
{
    private static AtomicReference atomicReference = new AtomicReference(0);

    public static void main(String[] args)
    {
        atomicReference.compareAndSet(0, 1);
        atomicReference.compareAndSet(1, 2);
        atomicReference.compareAndSet(1, 3);
        log.info("count:{}", atomicReference);
    }
}
